#!/bin/bash

export TOOLCHAINS_HOME=/opt/toolchains/uclibc-crosstools
export LIBS=-L$TOOLCHAINS_HOME/lib/gcc/mips-linux/3.4.2
export INCLUDES="-I$TOOLCHAINS_HOME/include/c++/3.4.2 -I$TOOLCHAINS_HOME/mips-linux/sys-include"
export CFLAGS="$INCLUDES $LIBS"
export LDFLAGS=-static
export CC=$TOOLCHAINS_HOME/bin/mips-uclibc-gcc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TOOLCHAINS_HOME/lib
export PATH=$PATH:$TOOLCHAINS_HOME/bin
export STRIP=$TOOLCHAINS_HOME/bin/mips-uclibc-strip
export TARGET_HOST=mips-linux

./configure --prefix=/var/mounts/sda1 \
            --download-dir=/var/mounts/sda1/download \
            --user=admin \
            --enable-static \
            --debug \
            --sub-version="aga-static-debug"

make clean
make
make install
make package-bin
